home *** CD-ROM | disk | FTP | other *** search
- #!/bin/sh
- # unpack.script -- UNIX shell script to unpack nethack archives
- #
- # This eliminates a lot of the tedium from snarfing a new nethack version
- # from linc.cis.upenn.edu. It automatically creates appropriate directories,
- # undoes uuencoding and compression, and untars tar files. When it's done
- # running you should have a complete clean source-tree.
-
- # System V style tars need the addition of the o option here
- #
- # If you didn't change this before running the script, you at least own
- # the created directories, so you can slowly and painfully rename and copy
- # each file so that you own it (or write your own simple script to
- # automate the process). Using chown with superuser privileges is of
- # course a much quicker recovery...
- #
- TAROPTS=xvf
- # TAROPTS=xovf
-
-
- # Changes to the source set should require at most additions to ARCHIVES
- # and (possibly) additions to the case statement mapping archives to
- # subdirectory names.
- #
- ARCHIVES1="Top Dat1 Dat2 Dat3 Dat4 Doc1 Doc2 Doc3 Incl1 Incl2 Incl3 Incl4 Util1 Util2"
- ARCHIVES2="Src1 Src2 Src3 Src4 Src5 Src6 Src7 Src8 Src9 Src10 Src11 Src12 Src13 Src14 Src15 Src16 Src17 Src18 Src19 Src20 Src21 Src22 Src23 Src24 Src25 Src26 Src27 Src28"
- ARCHIVES3="Amiga1 Amiga2 Amiga3 Amiga4 Amiga5 Amiga6 Amiga7 AmiSpl Atari Mac1 Mac2 Mac3 Mac4 Mac5 Mac6 Msdos1 Msdos2 Msdos3"
- ARCHIVES4="NT Os2 Shr1 Shr2 Shr3 Snd1 Snd2 Snd3 Snd4 Snd5 Unx1 Unx2 Vms1 Vms2 Vms3 Tty X1 X2 X3"
-
- # unconditionally create directories we may try to create subdirectories of
- if [ ! -d sys ]
- then
- mkdir sys
- fi
- if [ ! -d sys/amiga ]
- then
- mkdir sys/amiga
- fi
- if [ ! -d sys/share ]
- then
- mkdir sys/share
- fi
- if [ ! -d win ]
- then
- mkdir win
- fi
-
- if [ -f Shr.termcap.uu ]
- then
- if [ ! -d sys/share ]
- then
- mkdir sys/share
- fi
- mv Shr.termcap.uu sys/share/termcap.uu
- fi
-
- for i in NHproj.hqx NHsound.hqx
- do
- if [ -f Mac.$i ]
- then
- if [ ! -d sys/mac ]
- then
- mkdir sys/mac
- fi
- mv Mac.$i sys/mac/$i
- fi
- done
-
- for i in 1 2 3
- do
- if [ -f Cpp$i.shr ]
- then
- if [ ! -d sys/unix ]
- then
- mkdir sys/unix
- fi
- mv Cpp$i.shr sys/unix/cpp$i.shr
- fi
- done
-
- topdir=`pwd`
-
- for f in $ARCHIVES1 $ARCHIVES2 $ARCHIVES3 $ARCHIVES4
- do
- if [ -f ${f}.tar.Z.uu ]
- then
- uudecode ${f}.tar.Z.uu; rm ${f}.tar.Z.uu
- fi
- if [ -f ${f}.tar.Z ]
- then
- compress -d ${f}.tar.Z
- fi
-
- if [ -f ${f}.tar ]
- then
- # Here's the part that may need hacking as we add more machines
- case $f in
- Amiga*) dir=sys/amiga;;
- AmiSpl*) dir=sys/amiga/splitter;;
- Atari*) dir=sys/atari;;
- Dat*) dir=dat;;
- Doc*) dir=doc;;
- Incl*) dir=include;;
- Mac*) dir=sys/mac;;
- Msdos*) dir=sys/msdos;;
- NT*) dir=sys/winnt;;
- Os2*) dir=sys/os2;;
- Shr*) dir=sys/share;;
- Snd*) dir=sys/share/sounds;;
- Src*) dir=src;;
- Top*) dir=.;;
- Unx*) dir=sys/unix;;
- Util*) dir=util;;
- Vms*) dir=sys/vms;;
- Tty*) dir=win/tty;;
- X*) dir=win/X11;;
- esac
-
- echo Unpacking $f.tar into $dir ...
- if [ ! -d $dir ]
- then
- mkdir $dir
- fi
- if [ $dir != "." ]
- then
- mv $f.tar $dir;
- cd $dir
- fi
- tar $TAROPTS $f.tar
- rm $f.tar
- if [ $dir != "." ]
- then
- cd $topdir
- fi
- fi
- done
-
- echo "Remember to run sys/unix/setup.sh if you're compiling for UNIX."
-